# 中国工商银行账户管理系统
# import random
#
# def show_view():
#     print()
#     print('*********************************')
#     print('*           中国工商银行          *')
#     print('*           账户管理系统          *')
#     print('*             V 1.0             *')
#     print('*********************************')
#     print('*                               *')
#     print('*1.开户                          *')
#     print('*2.存钱                          *')
#     print('*3.取钱                          *')
#     print('*4.转账                          *')
#     print('*5.查询                          *')
#     print('*6.Bey！                         *')
#     print('*********************************')
#
# str_dict = {1: {'国家': '中国', '省份': '河南', '街道': '复兴街', '门牌号': '靠海大厦101'},
#             2: {'国家': '中国', '省份': '日本', '街道': '东京', '门牌号': '小男孩1945'}
#             }
# bank_dict = {1: '中国工商银行', 2: '中国工商银行日本支行'}
#
# customer_dict = {1: {'账号': '00001234', '姓名': 'Anj', '密码': 123456, '地址': '北京', '存储余额': 110000, '开户行': '中国工商银行'},
#                  2: {'账号': '00001235', '姓名': 'Bns', '密码': 123456, '地址': '北京', '存储余额': 10000, '开户行': '中国工商银行'}
#                  }
#
# #添加账户是否满足条件！
# def if_into_customer(i):
#
#     for v in customer_dict.values():
#         if v['姓名'] == i['姓名'] and v['密码'] == i['密码']:
#             print('用户已存在')
#             return 2
#     n = len(customer_dict)
#     if n > 100:
#         print('用户库已满')
#         return 3
#     else:
#         customer_dict[n+1] = i
#
#         print('成功')
#         return 1
#
# #添加账户
# def into_customer():
#     p_dict = {}
#     root = ''
#     for i in range(8):
#         root += str(random.randint(0,9))
#     for v in customer_dict.values():
#         if v['账号'] == root:
#             root = random.randint(10000000, 100000000-1)
#     p_dict['账号'] = root
#     p_dict['姓名'] = input('姓名：')
#     password = input('密码：')
#     if len(password) == 6 :
#         p_dict['密码'] = int(password)
#     else:
#         print('输入密码格式不对')
#     p_dict['地址'] = input('地址：')
#     p_dict['存储余额'] = int(input('存储余额：'))
#     p_dict['开户行'] = '中国工商银行'
#     i = if_into_customer(p_dict)
#     print(root, type(root), password, type(password))
#     if i == 1:
#         show_money(root, int(password))
#
# #存钱
# def into_money(root, money):
#
#     for v in customer_dict.values():
#         if v['账号'] == root:
#             v['存储余额'] += money
#             show_money(root, v['密码'])
#             return True
#         else:
#             return False
#
# #取钱
# def get_money(root, password, money):
#     for v in customer_dict.values():
#         if v['账号'] == root:
#             if v['密码'] == password:
#                 if v['存储余额'] >= money:
#                     v['存储余额'] -= money
#                     print('成功取出：{} 余额：{}'.format(money, v['存储余额']))
#                     show_money(root, password)
#                     return
#                 else:
#                     print('余额不足')
#                     return 3
#             else:
#                 print('密码错误')
#                 return 2
#         else:
#             print('账号不存在')
#             return 1
#
#
# #转账
# def come_money(root1, root2, password, money):
#     int1 = 0
#     list1 = []
#     for k, v in customer_dict.items():
#         if root1 == v['账号']:
#             list1.append(k)
#             int1 += 1
#     for k, v in customer_dict.items():
#         if root2 == v['账号']:
#             list1.append(k)
#             int1 += 1
#     if int1 == 2:
#         if root1 == customer_dict[list1[0]]['账号'] and password == customer_dict[list1[0]]['密码']:
#             if customer_dict[list1[0]]['存储余额'] >= money:
#                 customer_dict[list1[0]]['存储余额'] -= money
#                 customer_dict[list1[1]]['存储余额'] += money
#                 print('成功转出：{} 余额：{}'.format(money, customer_dict[list1[0]]['存储余额']))
#                 show_money(root1, password)
#                 return 0
#             else:
#                 print('余额不足')
#                 return 1
#         else:
#             print('密码错误')
#             return 2
#     else:
#         print('账号不对')
#         return 1
#
# #查询
# def show_money(root, password):
#     for v in customer_dict.values():
#         if v['账号'] == root and v['密码'] == password:
#             print('用户名：{}'.format(v['姓名']))
#             print('账号：{}'.format(v['账号']))
#             print('密码：{}'.format(v['密码']))
#             print('余额：{}'.format(v['存储余额']))
#             print('地址：{}'.format(v['地址']))
#             print('开户行：{}'.format(v['开户行']))
#             break
#     else:
#         print('账号或密码错误')
#
#
#
#
#
#
#
#
#
# for k, v in bank_dict.items():
#     print('银行{}: {}'.format(k, v))
# bank = input('请选择银行：')
#
#
#
#
# while bank:
#     show_view()
#     s1 = input('请输入：')
#     if s1 == '1':
#         into_customer()
#     elif s1 == '2':
#         root = input('请输入账号：')
#         money = int(input('请输入金额：'))
#         if into_money(root, money):
#             print('存储成功')
#         else:
#             print('没有该账号')
#     elif s1 == '3':
#         root = input('请输入账号：')
#         password = int(input('请输入密码：'))
#         money = int(input('请取出金额：'))
#         i = get_money(root, password, money)
#     elif s1 == '4':
#         root1 = input('请输入转出账号：')
#         password1 = int(input('请输入密码：'))
#         root2 = input('请输入转入账号：')
#         money = int(input('请输入转出金额：'))
#         i = come_money(root1, root2, password1, money)
#     elif s1 == '5':
#         root = input('请输入账号：')
#         password = int(input('请输入密码：'))
#         show_money(root, password)
#     elif s1 == '6':
#         print('Bey!')
#         break
#     input()
